package com.personalkeeper;

import com.google.android.maps.Overlay;

import android.graphics.drawable.Drawable;

public class CurrentMarkerLayer {

    private MarkersLayer mLayer;

    public CurrentMarkerLayer(Drawable defaultMarker) {
        mLayer = new MarkersLayer(defaultMarker);
    }

    public void set(Marker marker) {
        mLayer.clear();
        mLayer.addOverlay(marker);
    }

    public Marker get() {
        if (!isEmpty())
            return mLayer.get(0);
        else
            throw new IllegalStateException("no marker is set for this layer");
    }

    public boolean isEmpty() {
        return mLayer.size() == 0;
    }

    public void setOnTapListener(MarkersLayer.MarkerTapListener listener) {
        mLayer.setOnTapListener(listener);
    }

    public Overlay getOverlay() {
        return mLayer;
    }
}
